tf = open("f.txt","a+",encoding= 'utf-8')
ls = ["我是最后一行"]
tf.writelines(ls)
tf.seek(2)
for line in tf:
    print(line)
tf.close()